<template>
  <div style="height:100%" id="tableConfigList">
    <v-tableTitle :btnConfig="btnConfig" title="系统列表" @newCreat="newCreat" @del="del"></v-tableTitle>

    <GTable ref="table" :hasEdit="true" api="querySysColumnDefineList" :columnSource="baseColumns"
      @selection-change="data => tableSelectData = data" @setdialog="setdialog" />
  </div>
</template>

<script>
import tableTitle from "commons/TableTitle";
export default {
  name: 'tableConfigList',
  data() {
    return {
      tableSelectData:[]
    }
  },
  computed: {
    btnConfig() {
      return [
        {
          label: this.$t('common.add'),
          invalid: 'newCreat'
        }
      ]
    },
    baseColumns() {
      return [
        {
          label: this.$t('home1.menu_list_code'),
          prop: 'menu_list_code',
          input: 'input'
        },
        {
          label: this.$t('home1.menu_list_name'),
          prop: 'menu_list_name',
          input: 'input'
        },
        {
          label: this.$t('home1.menu_code'),
          prop: 'menu_code',
          input: 'input'
        },
        {
          label: this.$t('home1.menu_id'),
          prop: 'menu_id',
          input: 'input'
        },
        {
          label: this.$t('home1.remark'),
          prop: 'remark',
          input: 'input'
        }
      ]
    }
  },
  mounted() {
  },
  methods: {
    setdialog(data) {
      this.$store.commit('setRouteData', data)
      this.$router.push({ name: 'tableConfig' })
    },
    getTableData() {
      this.$refs.table.getTableData()
    },
    newCreat() {
      this.$store.commit('setRouteData', null)
      this.$store.commit('setNewFlag', true)
      this.$router.push({ name: 'tableConfig' })
    },
    del() {}
  },
  watch: {
    $route: {
      handler(newValue, oldValue) {
        if (oldValue.name === 'tableConfig') {
          this.$store.commit('setRouteData', {})
          this.$store.commit('setNewFlag', false)
          this.getTableData()
        }
      },
      deep: true
    }
  },
  components: {
    "v-tableTitle": tableTitle
  }
}
</script>

<style>
</style>